package com.joejag.mavenstats.client.service;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.ServiceDefTarget;

public interface ChartGenerator extends RemoteService
{

  public String generateSampleChart(String teamname);
  public String generateReport(String reportName);

  /**
   * Utility/Convenience class.
   * Use ChartGenerator.App.getInstance() to access static instance of ChartGeneratorAsync
   */
  public static class App
  {
    private static ChartGeneratorAsync ourInstance = null;

    public static synchronized ChartGeneratorAsync getInstance()
    {
      if (ourInstance == null)
      {
        ourInstance = (ChartGeneratorAsync) GWT.create(ChartGenerator.class);
        ((ServiceDefTarget) ourInstance).setServiceEntryPoint(GWT.getModuleBaseURL() + "com.joejag.mavenstats.MavenStats/ChartGenerator");
      }
      return ourInstance;
    }
  }
}
